package com.nyist;

/**
 * 1.
 *
 * @ClassName Main
 * @Description
 * @Author xiaoyang
 * @Date 2023/04/03/20:19
 */
public class Main {

    /* public static void main(String[] args) {
        int totalMoney = 100;
        int countNum = 10;
        RedEnvelope hongBao = new RedEnvelope(totalMoney, countNum);
        long startTime = System.currentTimeMillis();
        UserThread user = new UserThread(hongBao);
        for (int i = 0; i < 10; i++) {
            new Thread(user).start();
        }
        System.out.println("====1111耗时为:"+(System.currentTimeMillis()-startTime));
        System.out.println("================================");

        RedEnvelope2 redEnvelope2 = new RedEnvelope2(totalMoney, countNum);
        long startTime2 = System.currentTimeMillis();
        UserThread2 user2 = new UserThread2(redEnvelope2);
        for (int i = 0; i < 10; i++) {
            new Thread(user2).start();
        }
        System.out.println("====2222耗时为:"+(System.currentTimeMillis()-startTime2));
    } */

   /*  public static void main(String[] args) throws Exception {
        // 要执行的任务
        MyThreadCallable myThreadCallable = new MyThreadCallable();
        // 管理多线程运行的结果
        FutureTask<Integer> futureTask = new FutureTask<>(myThreadCallable);
        // 创建多线程对象
        Thread thread = new Thread(futureTask);
        thread.setName("call 111");
        thread.start();
        Thread thread2 = new Thread(futureTask);
        thread2.setName("call 222");
        thread2.start();

        thread.join();
        thread2.join();

        Integer total = futureTask.get();
        System.out.println(total);

    } */

    /* public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        MyThreadRunnable2 myThreadRunnable2 = new MyThreadRunnable2();
        executorService.submit(myThreadRunnable2);
        executorService.submit(myThreadRunnable2);
        executorService.submit(myThreadRunnable2);
        executorService.submit(myThreadRunnable2);
        executorService.submit(myThreadRunnable2);
    } */

    /* public static void main(String[] args) {
        MyThreadRunnable myThreadRunnable = new MyThreadRunnable();

        Thread myThreadExtendThread1 = new Thread(myThreadRunnable);
        myThreadExtendThread1.setName("一号 Runnable");
        myThreadExtendThread1.start();
        Thread myThreadExtendThread2 = new Thread(myThreadRunnable);
        myThreadExtendThread2.setName("二号 Runnable");
        myThreadExtendThread2.start();
        Thread myThreadExtendThread3 = new Thread(myThreadRunnable);
        myThreadExtendThread3.setName("三号 Runnable");
        myThreadExtendThread3.start();
        Thread myThreadExtendThread4 = new Thread(myThreadRunnable);
        myThreadExtendThread4.setName("四号 Runnable");
        myThreadExtendThread4.start();
        Thread myThreadExtendThread5 = new Thread(myThreadRunnable);
        myThreadExtendThread5.setName("五号 Runnable");
        myThreadExtendThread5.start();
    } */

    /* public static void main(String[] args) {
        MyThreadExtendThread2 myThreadExtendThread1 = new MyThreadExtendThread2();
        myThreadExtendThread1.setName("一号 222");
        myThreadExtendThread1.start();
        MyThreadExtendThread2 myThreadExtendThread2 = new MyThreadExtendThread2();
        myThreadExtendThread2.setName("二号 222");
        myThreadExtendThread2.start();
        MyThreadExtendThread2 myThreadExtendThread3 = new MyThreadExtendThread2();
        myThreadExtendThread3.setName("三号 222");
        myThreadExtendThread3.start();
        MyThreadExtendThread2 myThreadExtendThread4 = new MyThreadExtendThread2();
        myThreadExtendThread4.setName("四号 222");
        myThreadExtendThread4.start();
        MyThreadExtendThread2 myThreadExtendThread5 = new MyThreadExtendThread2();
        myThreadExtendThread5.setName("五号 222");
        myThreadExtendThread5.start();
    } */

    /* public static void main(String[] args) {
        MyThreadExtendThread myThreadExtendThread1 = new MyThreadExtendThread();
        myThreadExtendThread1.setName("一号 111");
        myThreadExtendThread1.start();
        MyThreadExtendThread myThreadExtendThread2 = new MyThreadExtendThread();
        myThreadExtendThread2.setName("二号 111");
        myThreadExtendThread2.start();
        MyThreadExtendThread myThreadExtendThread3 = new MyThreadExtendThread();
        myThreadExtendThread3.setName("三号 111");
        myThreadExtendThread3.start();
        MyThreadExtendThread myThreadExtendThread4 = new MyThreadExtendThread();
        myThreadExtendThread4.setName("四号 111");
        myThreadExtendThread4.start();
        MyThreadExtendThread myThreadExtendThread5 = new MyThreadExtendThread();
        myThreadExtendThread5.setName("五号 111");
        myThreadExtendThread5.start();
    } */

}